import Vue from 'vue';
import Vuex from 'vuex';
import Cache from '../utils/cache';

Vue.use(Vuex);
export default new Vuex.Store({
    state: {
        id: Cache.getSession('userId'),
        userName: Cache.getSession('userName'),
        token: Cache.getSession('token'),
        // business
        showFooter: Cache.getSession('show_footer') || '1', // 是否显示底部导航 string-> '1'-> show '0'-> hide

    },
    mutations: {
        setUserId(state, val) {
            state.id = val;
        },
        setUserName(state, val) {
            state.username = val;
        },
        setToken(state, val) {
            state.token = val;
        },
        setShowFooter(state, val) {
            state.showFooter = val;
        },
    },
});
